<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ include file="/page/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/adapter/adapter-bootstrap.jsp" %>
</head>
<script type="text/javascript">

function save(){
	var str_data=$("#templateinfo input").map(function(){
		   return ($(this).attr("name")+'='+$(this).val());
		 }).get().join("&") ;
    $.ajax({
        url:"${ctx}/template/saveTemplate",
        type: "POST",      
        dataType:"json",
        data: str_data,
        async: false,
        success: function(data) {
        	if(data.flag>0){
	            alert("保存成功！");	
	            //window.location.reload();
        	}
/* 	          $.each(data, function(index, element) {
             window.location.reload();
          }); */
        },
        error: function() {
          alert("error");
        }
      });
	
}

function  goBack(){
	//window.location.href='${ctx}/appFrameModule1/appFrameTradeMain?appid=${appid}'
	window.history.back(-1);
	//window.history.go(-2);
}
</script>

<body>
<div class="panel panel-default ">
   <div class="panel-heading">
      <h3 class="panel-title">
          创建模板
      </h3>
   </div>
   <div class="panel-body">
<form class="form-horizontal" role="form" id="templateinfo" name="baseinfo"  action="${pageContext.request.contextPath }/template/saveBaseInfo" method="post">
                  <br></br>
                                               <input type="hidden" name="templateType" id="templateType" value="${type}"/>
                        <div class="form-group">
                          <label class="col-xs-2 control-label" for="templateId">模板标识</label>
                          <div class="col-xs-3">
                             <input class="form-control" id="templateId"  name="templateId"  type="text" placeholder="0010010001"/>
                          </div>
                          <label class="col-xs-2 control-label" for="templateName">模板名称</label>
                          <div class="col-xs-3">
                             <input class="form-control" id="templateName" name="templateName"  type="text" placeholder="标准新增页面模板"/>
                          </div>                           
                       </div>
<!--                        <div class="form-group">
                          <label class="col-xs-2 control-label" for="templateType">模板类型</label>
                          <div class="col-xs-3">
                             <input class="form-control" id="templateType" name="templateType" type="text" placeholder="0010010001"/>

                          </div>                       
                       </div> -->
                       <div class="form-group">
                          <label class="col-xs-2 control-label" for="longDesc">模板描述</label>
                          <div class="col-xs-8">
<!--                              <textarea class="form-control"  id="longDesc"  name="longDesc" rows="5"></textarea> -->
                             <input type="text"  class="input-sm form-control"  id="longDesc"  name="longDesc" value="${STemplateBase.longDesc}"   />
                             
                          </div>                       
                       </div> 
                    <br></br>

					<div class="form-group">
						<div class="col-xs-5"></div>
						<div class="col-xs-5">
							<button type="button" class="btn btn-default" onclick="save()">&nbsp;&nbsp;确定&nbsp;&nbsp;</button>
							<button type="button" class="btn btn-default"  onclick="history.go(-1)">&nbsp;&nbsp;返回&nbsp;&nbsp;</button>
						</div>
					</div>
                    <br></br>
                </form>
	</div>
	</div>
</body>
</html>
